from rich.progress import track
import time
def do_work(n):
    print('input n is ', n)
    time.sleep(2)

for i in track(range(10), description='progress...'):
    do_work(i)

from rich.progress import Progress

with Progress() as progress:

    task1 = progress.add_task("[red]Downloading...", total=1000)
    task2 = progress.add_task("[green]Processing...", total=1000)
    task3 = progress.add_task("[cyan]Cooking...", total=1000)

    while not progress.finished:
        progress.update(task1, advance=0.5)# 当一个task完成时，使用update对task进行更新, advance是每一次更新的距离
        progress.update(task2, advance=0.3)
        progress.update(task3, advance=0.9)
        time.sleep(0.02)